VCC=verilator

VFILES := $(wildcard *.v)
CPU_FILE=ppa1_cpu.v
SIM_MAIN=sim_main.cpp

BUILDDIR=build
EXECNAME=Vppa1_cpu

VFLAGS=-Wall --clk clk --Mdir $(BUILDDIR)

all: codegen compilation

codegen: $(VFILES)
	$(VCC) $(VFLAGS) --cc $(CPU_FILE) --exe $(SIM_MAIN) 

compilation:
	cd $(BUILDDIR) && make -j -f Vppa1_cpu.mk $(EXECNAME)

run:
	./$(BUILDDIR)/$(EXECNAME)

clean:
	rm -rf $(BUILDDIR)
